<?php
/** @var OportunidadController $this */
/** @var Oportunidad $model */
/** @var AweActiveForm $form */
// Prevenir que jquery se cargue dos veces
//Util::tsRegisterAssetJs('_form_modal.js');
$form = $this->beginWidget('ext.AweCrud.components.AweActiveForm', array(
    'id' => 'lista-form',
    'type' => 'horizontal',
//    'action' => Yii::app()->createUrl('/crm/contacto/create'),
    'enableAjaxValidation' => true,
    'clientOptions' => array('validateOnSubmit' => false, 'validateOnChange' => false,),
    'enableClientValidation' => false,
        ));
if ($isModal) {
    Yii::app()->clientScript->scriptMap['jquery.js'] = false;
    Yii::app()->clientScript->scriptMap['jquery.yiigridview.js'] = false;
}
?>
<div class="modal-header">
    <a class="close" data-dismiss="modal">&times;</a>
    <h4><i class="icon-tag"></i> Agregar Lista </h4>
</div>
<div class="modal-body">

    <!--<div class="addUserNew-grid"></div>-->
    <?php
//    var_dump($UsuariosDP->getdata());
//    die();
//    $this->widget('bootstrap.widgets.TbGridView', array(
//        'id' => 'addUserNew-grid',
//        'afterAjaxUpdate' =>
//        "function(id,data){
//            updateCheckedRaw();
//            loadActionSelect();
//            }",
//        'type' => 'striped bordered hover advance',
//        'dataProvider' => $listasValidasProvider,
//        'selectableRows' => 2,
//        'columns' => array(
////            array(
////                'name' => '<input type="checkbox"  id="selectall" value="all">',
////                'type' => 'raw',
////                'value' => '"<input type=\"checkbox\" id=\"ckb_".$data->id."\" class=\"ckeckRow\" value=\"$data->id\">"',
////            ),
//            array(
//                'name' => 'Nombre Lista',
//                'value' => '$data->nombre',
//                'type' => 'raw',
//            ),
//          
////            array(
////                'name' => 'Ultima Session',
////                'type' => 'raw',
////                'value' => '$data->ultimaSesionUsuario("$data->id")',
////            ),
//          
//            
//        ),
//    ));
    $model_cuenta = Lista::model()->searchListasActivas("ACTIVO", $limite);
    $models = new Lista;
//                  $listasValidas = $model->searchListasActivas($idActivo, $limite);
    if (!empty($model_cuenta)) {
        echo $form->select2Row($models, 'id', array(
            'asDropDownList' => true,
            'data' => CHtml::listData($model_cuenta, 'id', 'nombre'),
            'empty' => array(0 => '- Ninguna -'),
            'class' => 'span10',
            'options' => array(
                'placeholder' => 'type clever, or is, or just type!',
            )
        ));
    }
//            echo $form->dropDownListRow($models, 'estado', array('ACTIVO' => 'ACTIVO', 'INACTIVO' => 'INACTIVO',)) 
    ?>
</div>
<div class="modal-footer">
    <?php
    $this->widget('bootstrap.widgets.TbButton', array(
        'type' => 'success',
        'icon' => 'ok',
        'label' => Yii::t('AweCrud.app', 'Agregar'),
        'htmlOptions' => array(
            'onClick' => 'js:ajaxAgregar()')
    ));
    ?>
    <?php
    $this->widget('bootstrap.widgets.TbButton', array(
        'icon' => 'remove',
        'label' => Yii::t('AweCrud.app', 'Cancel'),
        'htmlOptions' => array(
            'data-dismiss' => 'modal',)
    ));
    ?>
</div>

<?php $this->endWidget(); ?>